xen-netback: fix input validation in xenvif_set_hash_mapping()
authorJan Beulich <JBeulich@suse.com>
Tue, 25 Sep 2018 08:12:30 +0000 (02:12 -0600)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 7 Oct 2018 20:57:06 +0000 (21:57 +0100)
commit06c925429c556a07a751dade751bbca5df194fe9
tree917f61fba4957ffd16052f4e692a649650d807dc
parent51237335a27dc447835238497e7c15dde3a4b082
xen-netback: fix input validation in xenvif_set_hash_mapping()

Both len and off are frontend specified values, so we need to make
sure there's no overflow when adding the two for the bounds check. We
also want to avoid undefined behavior and hence use off to index into
->hash.mapping[] only after bounds checking. This at the same time
allows to take care of not applying off twice for the bounds checking
against vif->num_queues.

It is also insufficient to bounds check copy_op.len, as this is len
truncated to 16 bits.

This is XSA-270 / CVE-2018-15471.

Reported-by: Felix Wilhelm <fwilhelm@google.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Tested-by: Paul Durrant <paul.durrant@citrix.com>
Cc: stable@vger.kernel.org [4.7 onwards]
Signed-off-by: David S. Miller <davem@davemloft.net>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name xen-netback-fix-input-validation-in-xenvif_set_hash_.patch
drivers/net/xen-netback/hash.c